package com.rt.tmpt.service;

import com.googlecode.genericdao.search.Search;
import com.rt.tmpt.dto.*;
import com.rt.tmpt.dto.*;

import java.util.List;
import java.util.Map;
import java.util.Set;


public interface ISecurityV2Service {

	
	/**
	 * create a menu level one
	 * @param menu1Dto
	 * @param logDto
	 * @return
	 */
	public Result addA2Menu1(A2Menu1Dto menu1Dto, A1OperationlogDto logDto);
	
	/**
	 * create a menu level two
	 * @param menu2Dto
	 * @param logDto
	 * @return
	 */
	public Result addA2Menu2(long a2Menu1Id, A2Menu2Dto menu2Dto, A1OperationlogDto logDto);
	
	
	/**
	 * create a menu function
	 * @param menuFunDto
	 * @param logDto
	 * @return
	 */
	public Result addA2MenuFunction(long a2Menu2Id, A2MenuFunctionDto menuFunDto, A1OperationlogDto logDto);
	

	/**
	 * add a company
	 * @param a2CompanyDto
	 * @param logDto
	 * @return
	 */
	public Result addA2Compnay(A2CompanyDto a2CompanyDto, A1OperationlogDto logDto);
	
	/**
	 * 查询公司-部门
	 * @param search
	 * @return
	 */
	public Result<A2CompanyDto> queryA2CompnayList(Search search);
	/**
	 * add a department
	 * @param a2CompanyId
	 * @param a2DeptDto
	 * @param logDto
	 * @return
	 */
	public Result addA2Dept(long a2CompanyId, A2DeptDto a2DeptDto, A1OperationlogDto logDto);
	
	/**
	 * add a user
	 * @param a2DeptId
	 * @param a2UserDto
	 * @param logDto
	 * @return
	 */
	public Result addA2User(long a2DeptId, A2UserDto a2UserDto, A1OperationlogDto logDto);
	

	/**
	 * add a role
	 * @param a2RoleDto
	 * @param logDto
	 * @return
	 */
	public Result addA2Role(A2RoleDto a2RoleDto, A1OperationlogDto logDto);
	
	/**
	 * query role List
	 * @return
	 */
	public Result<A2RoleDto> queryA2RoleList();
	
	/**
	 * 查询用户所拥有的角色列表
	 * @param userId
	 * @return
	 */
	public Result<A2RoleDto> queryA2RoleListByUser(long userId);
	
	/**
	 * 绑定角色 和 菜单
	 * @param roleId
	 * @param menu1IdMap {menu1Id,[menu2Id=write,menu2Id=read]}
	 * @param accessType
	 * @param logDto
	 * @return
	 */
	public Result bindRole_Menu(String roleName, Map<Long, Map<Long, Map<String, Object>>> menu1IdMap, A1OperationlogDto logDto);
	//public Result bindRole_Menu(long roleId, Map<Long,Map<Long,String>> menu1IdMap,A1OperationlogDto logDto);
	
	
	
	/**
	 * 给用户分配角色
	 * @param userId
	 * @param roleIdList
	 * @param logDto
	 * @return
	 */
	public Result bindUser_Role(long userId, List<Long> roleIdList, A1OperationlogDto logDto);
	
	/**
	 * 用户的菜单和URL列表
	 * @param userId
	 * @return
	 */
	public Result queryMenusByUser(long userId);
	
	/**
	 * 查询所有的菜单,菜单配置
	 * @return
	 */
	public Result queryMenus4Conf();
	
	/**
	 * 查询所有的菜单,角色配置
	 * @return
	 */
	public Result queryMenus4RoleConf();
	
	/**
	 * 查询所有的菜单,角色配置,某角色所拥有的菜单checked
	 * @param userId
	 * @return
	 */
	public Result queryMenus4RoleConfByRoleId(long roleId);
	

	/**
	 * 登录时调用
	 * @param loginname
	 * @return
	 */
	public A2UserDto getUserByLoginname(String loginname);

	public A2UserDto getUserByAppLoginname(String appLoginname);
	public Result updateClientIDByUser(String userId, String clientID);
	/**
	 * 登录时调用
	 * @param userDto
	 */
	public void recordLastLoginInfo(A2UserDto userDto);

	/**
	 * 登录时调用
	 * @param url
	 * @return
	 */
	public Set<String> getMenu2AuthListByUrl(String url);
	
	
	
	
	
	
	/**
	 * 自定义：用户信息查询
	 * @param mapParam
	 * @return
	 */
	public Result<A2UserDto> queryUserList(Map<String, Object> mapParam);
	
	/**
	 * 自定义：用户历史信息查询
	 * @param mapParam
	 * @return
	 */
	public Result<A2UserDto> queryUserHistoryList(Map<String, Object> mapParam);
	

	/**
	 * 查询一级菜单List
	 * @return
	 */
	public Result<A2Menu1Dto> queryMenu1List();
	
	
	/**
	 * 查询用户的桌面图标
	 * @param userId
	 * @return
	 */
	public Result queryDesktopByUser(long userId);
	
	/**
	 * 给用户添加桌面图标
	 * @param userId
	 * @param desktopDto
	 * @return
	 */
	public Result addMenu2Desktop(long userId, A2UserDesktopDto desktopDto);
	

	/**
	 * 给用户删除桌面图标
	 * @param desktopId
	 * @return
	 */
	public Result removeMenu2Desktop(long desktopId);


	/**
	 * 重置密码
	 * @param userId
	 * @param passwordNew
	 * @return
	 */
	public Result resetPassword(long userId, String passwordNew);


	public A2UserDto queryUserById(String userId);
}
